/**
 * 对话框工具类（基于bootstrap）
 */

/**
 * 一级全局变量命名空间
 */
var $g;
if(!$g)$g = new Object();

/**
 * 对话框全局变量命名空间
 */
$g.modal = new Object();

/**
 * 创建模式对话框
 * @param options 首选项
 */
$g.modal.create = function(options){
	var dialog = $('<div class="modal-dialog"></div>').appendTo(options.id);
	var content = $('<div class="modal-content"></div>').appendTo(dialog);
	var form = $('<form id="' + options.name + 'Form" class="form-horizontal"></div>').appendTo(content);
	var header = $('<div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button><h4 class="modal-title">' + options.title +'</h4></div>').appendTo(form);
	var body = $('<div class="modal-body"></div>').appendTo(form);
	var footer = $('<div class="modal-footer"><button type="button" class="btn btn-default" id="submitForm"><i class="glyphicon glyphicon-ok"></i>保存</button></div>').appendTo(form);
	options.created = true;
}

